import request from "@/utils/request";

export function getBuilding(method, data) {
  if (method == "post") {
    return request({
      url: "/building",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/building",
      method: method,
      params: data,
    });
  }
}
export function getFloor(method, data) {
  if (method == "post") {
    return request({
      url: "/floor",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/floor",
      method: method,
      params: data,
    });
  }
}
export function getRoom(method, data) {
  if (method == "post") {
    return request({
      url: "/room",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/room",
      method: method,
      params: data,
    });
  }
}
export function getBed(method, data) {
  if (method == "post") {
    return request({
      url: "/bed",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/bed",
      method: method,
      params: data,
    });
  }
}
export function getroomlist(method, data) {
  if (method == "post") {
    return request({
      url: "/building/roomlist",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/building/roomlist",
      method: method,
      params: data,
    });
  }
}

//网关登录
export function gatewayLogin(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/login",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/login",
      method: method,
      params: data,
    });
  }
}

//获取设备列表
 // host_id,build_id,floor_id,room_id,bed_id,area_type 非必填
export function getdeviceList(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/list",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/list",
      method: method,
      params: data,
    });
  }
}

//执行设备开关
 // onoff,host_id,build_id,floor_id,room_id,bed_id,type,area_type,code 非必填
export function getdevOnoff(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/allonoff",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/allonoff",
      method: method,
      params: data,
    });
  }
}

//获取情景列表
 // build_id,floor_id,room_id,bed_id,name 非必填
export function getdevScene(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/scene",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/scene",
      method: method,
      params: data,
    });
  }
}

//执行情景
 // id 必填
export function getSceneDone(method, data) {
  if (method == "post") {
    return request({
      url: "/dev/done",
      method: method,
      data,
    });
  } else {
    return request({
      url: "/dev/done",
      method: method,
      params: data,
    });
  }
}
